<%@page import="javax.swing.tree.TreeNode"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8"%>
<%
  String path = request.getContextPath();
  String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>权限资源</title>
  <link rel="stylesheet" type="text/css" href="<%=path %>/style/easyui.css">
  <link rel="stylesheet" type="text/css" href="<%=path %>/style/icon.css">
  <link rel="stylesheet" type="text/css" href="<%=path %>/style/neweasyui/themes/gray/panel.css">
  <link rel="stylesheet" type="text/css" href="<%=path %>/style/neweasyui/themes/gray/window.css">
  
  <link rel="stylesheet" type="text/css" href="<%=path %>/script/zTree_v3/css/zTreeStyle/zTreeStyle.css" >
  <link rel="stylesheet" type="text/css" href="<%=path %>/script/zTree_v3/css/demo.css" >
  
  <script type="text/javascript" src="<%=path %>/script/1.11.1.js"></script>
  <script type="text/javascript" src="<%=path %>/script/jquery.easyui.min.js"></script>
  <script type="text/javascript" src="<%=path %>/script/easyui-lang-zh_CN.js"></script>
  <script type="text/javascript" src="<%=path %>/script/dateFormat.js"></script>
  <script type="text/javascript" src="<%=path %>/script/datagrid-bufferview.js"></script>
  <script type="text/javascript" src="<%=path %>/script/common.js"></script>
  <script type="text/javascript" src="<%=path %>/script/zTree_v3/js/jquery.ztree.core-3.5.js"></script>  
  <script type="text/javascript" src="<%=path %>/script/zTree_v3/js/jquery.ztree.excheck-3.5.js"></script>  
  <script type="text/javascript" src="<%=path %>/script/zTree_v3/js/jquery.ztree.exedit-3.5.js"></script> 
  <style type="text/css">
    #fm{
      margin:0;
      padding:10px 30px;
    }
    .ftitle{
      font-size:14px;
      font-weight:bold;
      padding:5px 0;
      margin-bottom:10px;
      border-bottom:1px solid #ccc;
    }
    .fitem{
      margin-bottom:17px;
    }
    .fitem label{
      display:inline-block;
      width:80px;
    }
    .fitem input{
      width:230px;
    }
  </style>
</head>
<body>
<script type="text/javascript">
	$.ajaxSetup({async : false});  
	var setting = {
			async:{
				enable: true,
			},
			data:{
				simpleData:{
					enable:true,
				}
			},
			callback:{
				onClick:onClick
			}
	}
	function onClick(event, treeId, treeNode, clickFlag) {
		/*
		window.parent.frames["rightRight"].location.href="<%=basePath %>authority/right/detail/"+treeNode.id;
		*/
		 $.ajax({
		        type: "GET",
		        dataType: "json",
		        traditional: true,
		        url: "<%=basePath %>authority/right/detail/"+treeNode.id+"?value=1",
		        async: true,//表示同步执行
		        success: function (data, textStatus) {
					window.parent.frames["rightRight"].location.href="<%=basePath %>pages/authority/rightRight.jsp";
		        },
		        complete: function (XMLHttpRequest, textStatus) { },
		        error: function (e) {
		            alert("节点ID数据传递失败，请刷新页面重新加载！");
		        }
		    });
	}
	$(function(){
	 $.ajax({
	        type: "GET",
	        dataType: "json",
	        traditional: true,
	        url: "<%=basePath %>authority/left/tree",
	        async: false,//表示同步执行
	        success: function (data, textStatus) {
	            if (data != null) {
	                treeObj = $.fn.zTree.init($("#demo"), setting, data);   
	                var nodes = treeObj.getNodes();
	                treeObj.expandNode(nodes[0], true, false, true);
	            }
	        },
	        complete: function (XMLHttpRequest, textStatus) { },
	        error: function (e) {
	            alert("获取测试类型统计数据失败，请刷新页面重新加载！");
	        }
	    });
	});

</script>
<ul id="demo" class="ztree" style="height:820px;border:1px #000 solid;overflow:auto;">
</ul>
</body>
</html>
